package com.bindapp.model;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;

import com.bindapp.R;
import com.bindapp.adapter.MainTab1ThreeAdapter;
import com.bindapp.databinding.FragmentTab1twoBinding;
import com.bindapp.listener.RecyclerItemClick;
import com.bindapp.widget.RVItemDecoration;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by apple on 2018/6/29.
 */

public class TabOne3Model extends BaseModel {

    private FragmentTab1twoBinding binding;
    private MainTab1ThreeAdapter adapter;
    private List<Object> datalist=new ArrayList<Object>();

    public TabOne3Model(Context context) {
        super(context);
        binding= DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.fragment_tab1two,null,false);

        datalist.addAll(Arrays.asList(context.getResources().getStringArray(R.array.tab1threelabel)));
        adapter=new MainTab1ThreeAdapter(context,datalist,R.layout.item_tab1_three,-1,new ItemClick());
        binding.recycleview.setAdapter(adapter);
        binding.recycleview.addItemDecoration(new RVItemDecoration(15));
        binding.recycleview.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    }

    class ItemClick implements RecyclerItemClick {

        @Override
        public void onItemClick(int position) {

        }

        @Override
        public void onItemLongClick(int position) {

        }

        @Override
        public void onMoreClick(View view, int position) {

        }
    }

    @Override
    public FragmentTab1twoBinding getBinding() {
        return binding;
    }
}
